﻿using Edge.Repository.Base;
using Edge.Repository.Model.ResistanceWelding;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Edge.Repository.Model.EMS
{
    [SqlSugar.SugarTable("Ems_Equipment")]
    public class EmsEquipModel : EdgeBaseModel
    {



        /// <summary>
        ///  名称
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Name { get; set; }



        /// <summary>
        ///  地址
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Code { get; set; }


        /// <summary>
        ///  地址
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Ip { get; set; }


        /// <summary>
        ///  类型, 1 带氢气，2 不带氢气
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int Type { get; set; }

        [SugarColumn(IsIgnore = true)]
        public string TypeName
        {
            get
            {
                return this.Type == 1 ? "带氢气" : "不带氢气";

            }
        }

        /// <summary>
        ///  备注
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Remark { get; set; }


        /// <summary>
        ///  状态
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int State { get; set; }


        /// <summary>
        ///  温湿度数量
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int WenShiDuCount { get; set; } = 8;
    }



    [SqlSugar.SugarTable("Ems_Alarm")]
    public class EmsAlarmModel : EdgeBaseModel
    {


        /// <summary>
        ///  名称
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Name { get; set; }



        /// <summary>
        ///  地址
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Code { get; set; }




        /// <summary>
        ///  备注
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Remark { get; set; }


        /// <summary>
        ///  状态
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int State { get; set; }

        /// <summary>
        ///  Ip
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Ip { get; set; }

        /// <summary>
        ///  报警时间
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime AlarmTime { get; set; }


        /// <summary>
        ///  报警数据包
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string AlarmData { get; set; }



        /// <summary>
        ///  报警数据包
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string RecordData { get; set; }


    }



    /// <summary>
    ///  设备 
    /// </summary>
    public class EmsEquipService : BaseRepository<EmsEquipModel>
    {
        public EmsEquipModel GetModelByIp(string ip)
        {
            EmsEquipModel model = this.Query(F => F.Ip == ip).FirstOrDefault();

            return model;
        }
    }
    /// <summary>
    ///  设备 
    /// </summary>
    public class EmsAlarmService : BaseRepository<EmsAlarmModel>
    {
    }

}
